from datetime import datetime
import boto3
import json

sqs = boto3.client('sqs')

asin_list = ["B089DR29T6", "B01N1Z2HUS", "B08KY684PB"]

task_list = [{
    "url": f"https://www.amazon.com/product-reviews/{asin}",
    "parser": "reviewParser",
    "metadata": {
        "asin": asin,  # JimmyMo: 对于ProductsDetailSpider，建议在metadata中增加asin，从url中获取不太靠谱
        "batchId": "2021-07-02",
        "tt": "AsinCustomerReview"
    }
} for asin in asin_list]

for task in task_list:
    sendMessageResp = sqs.send_message(
                    QueueUrl="pt-spider-serverless-AsinCustomerReview-queue",
                    MessageBody=json.dumps(task)
                )
    print(f"sent task: {task}")
print("done")